<?php
/*
 * Created on 22-04-2011
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 require_once('Codes.php');
 require_once('Entanglement.php');
 
 if(!empty($_POST)){
  	if(!isset($_POST['synchKey'])){
    	return constant("ARGUMENT_NULL").':synchKey';
  	}
  $synchKey = $_POST['synchKey'];
  
    if(!isset($_POST['publicKey'])){
    	return constant("ARGUMENT_NULL").':publicKey';
  	}
  $publicKey = $_POST['publicKey'];
  
  
  } else{
	return constant("ARGUMENT_NULL").':ALL';
}

$entanglement = Entanglement::Get($synchKey);
$uid = $entanglement->AddUser($publicKey);
$entanglement->Put();
echo constant("ENTANGLED").":$uid";
?>
